import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    me: null,
    url: null,
    jssdk_config: null,
    shop_name: null,
    productInfo: null
  },
  mutations: {
    set_me (state, me) {
      state.me = me
    },
    set_url (state, url) {
      state.url = url
    },
    set_product_info (state, productInfo) {
      state.productInfo = productInfo
    },
    set_jssdk_config (state, jssdkConfig) {
      state.jssdk_config = jssdkConfig
    },
    set_shop_name (state, name) {
      state.shop_name = name
    },
    logout (state) {
      state.me = null
    }

  }
})

export default store
